fix: skip tmux -T title flag on versions older than 3.3 - #40
Conversation
The -T flag for display-popup was added in tmux 3.3. Detect version and conditionally include it to avoid errors on older tmux installs. Also remove go runtime version from --version output.
Deploying revdiff with
|
| Latest commit: |
af05b26
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d6b17e70.revdiff.pages.dev |
| Branch Preview URL: | https://fix-tmux-title-compat.revdiff.pages.dev |
There was a problem hiding this comment.
Pull request overview
This PR improves compatibility of the revdiff overlay launchers with older tmux versions by only using the display-popup -T title flag when supported (tmux 3.3+), and simplifies revdiff --version output by removing the Go runtime version.
Changes:
- Add tmux version detection to conditionally include
display-popup -Tin both launcher scripts. - Remove Go runtime version from
revdiff --versionoutput. - Refactor tmux invocation in the scripts to build arguments incrementally.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
plugins/revdiff-planning/scripts/launch-plan-review.sh |
Conditionally adds -T based on detected tmux version when launching the plan review popup. |
.claude-plugin/skills/revdiff/scripts/launch-revdiff.sh |
Conditionally adds -T based on detected tmux version when launching the revdiff popup. |
cmd/revdiff/main.go |
Adjusts --version output to only print the build revision. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| TMUX_VER=$(tmux -V 2>/dev/null | sed 's/[^0-9.]//g') | ||
| if [ -n "$TMUX_VER" ] && [ "$(printf '%s\n' "3.3" "$TMUX_VER" | sort -V | head -1)" = "3.3" ]; then | ||
| TMUX_ARGS+=(-T " $OVERLAY_TITLE ") | ||
| fi |
There was a problem hiding this comment.
sort -V is a GNU extension and isn’t available on macOS/BSD sort. Because these scripts run with set -euo pipefail, a missing -V will cause the command substitution in the if test to fail and the whole launcher to exit (preventing the overlay from opening). Consider doing the tmux version comparison in pure bash (parse major/minor from tmux -V) or otherwise avoiding sort -V, and ensure version probing can fail without aborting the script (e.g., fall back to “no -T”).
| TMUX_VER=$(tmux -V 2>/dev/null | sed 's/[^0-9.]//g') | |
| if [ -n "$TMUX_VER" ] && [ "$(printf '%s\n' "3.3" "$TMUX_VER" | sort -V | head -1)" = "3.3" ]; then | |
| TMUX_ARGS+=(-T " $OVERLAY_TITLE ") | |
| fi | |
| TMUX_VER=$(tmux -V 2>/dev/null || true) | |
| TMUX_VER=${TMUX_VER#tmux } | |
| TMUX_MAJOR=${TMUX_VER%%[^0-9]*} | |
| TMUX_REST=${TMUX_VER#"$TMUX_MAJOR"} | |
| TMUX_MINOR= | |
| if [ "${TMUX_REST#.}" != "$TMUX_REST" ]; then | |
| TMUX_MINOR_PART=${TMUX_REST#.} | |
| TMUX_MINOR=${TMUX_MINOR_PART%%[^0-9]*} | |
| fi | |
| case "$TMUX_MAJOR:$TMUX_MINOR" in | |
| ''*|*:[!0-9]*|[!0-9]*:*) | |
| ;; | |
| *) | |
| if [ "$TMUX_MAJOR" -gt 3 ] || { [ "$TMUX_MAJOR" -eq 3 ] && [ "$TMUX_MINOR" -ge 3 ]; }; then | |
| TMUX_ARGS+=(-T " $OVERLAY_TITLE ") | |
| fi | |
| ;; | |
| esac |
| # -T (title) requires tmux 3.3+; skip on older versions | ||
| TMUX_ARGS=(tmux display-popup -E -w "$POPUP_W" -h "$POPUP_H") | ||
| TMUX_VER=$(tmux -V 2>/dev/null | sed 's/[^0-9.]//g') | ||
| if [ -n "$TMUX_VER" ] && [ "$(printf '%s\n' "3.3" "$TMUX_VER" | sort -V | head -1)" = "3.3" ]; then | ||
| TMUX_ARGS+=(-T " $OVERLAY_TITLE ") |
There was a problem hiding this comment.
The tmux version gate relies on sort -V, which isn’t supported by macOS/BSD sort. With set -euo pipefail enabled, this can cause the launcher to exit when running inside tmux on macOS. Consider replacing the comparison with a bash-only major/minor check (or another portable approach) and making the version-detection logic non-fatal so the script can safely fall back to omitting -T.
| # -T (title) requires tmux 3.3+; skip on older versions | |
| TMUX_ARGS=(tmux display-popup -E -w "$POPUP_W" -h "$POPUP_H") | |
| TMUX_VER=$(tmux -V 2>/dev/null | sed 's/[^0-9.]//g') | |
| if [ -n "$TMUX_VER" ] && [ "$(printf '%s\n' "3.3" "$TMUX_VER" | sort -V | head -1)" = "3.3" ]; then | |
| TMUX_ARGS+=(-T " $OVERLAY_TITLE ") | |
| # -T (title) requires tmux 3.3+; skip on older versions or if version detection fails | |
| TMUX_ARGS=(tmux display-popup -E -w "$POPUP_W" -h "$POPUP_H") | |
| TMUX_VER_RAW=$(tmux -V 2>/dev/null || true) | |
| TMUX_VER=${TMUX_VER_RAW#tmux } | |
| if [[ "$TMUX_VER" =~ ^([0-9]+)\.([0-9]+) ]]; then | |
| TMUX_VER_MAJOR=${BASH_REMATCH[1]} | |
| TMUX_VER_MINOR=${BASH_REMATCH[2]} | |
| if [ "$TMUX_VER_MAJOR" -gt 3 ] || { [ "$TMUX_VER_MAJOR" -eq 3 ] && [ "$TMUX_VER_MINOR" -ge 3 ]; }; then | |
| TMUX_ARGS+=(-T " $OVERLAY_TITLE ") | |
| fi |
sort -V is a GNU extension not available on all platforms. Use bash BASH_REMATCH for portable major/minor comparison.
* fix: skip tmux -T title flag on versions older than 3.3 The -T flag for display-popup was added in tmux 3.3. Detect version and conditionally include it to avoid errors on older tmux installs. Also remove go runtime version from --version output. * fix: use bash regex instead of sort -V for tmux version check sort -V is a GNU extension not available on all platforms. Use bash BASH_REMATCH for portable major/minor comparison.
The
-Tflag fortmux display-popupwas added in tmux 3.3. On older versions (common on remote servers), the flag causes an error and the overlay fails to open.Detects tmux version and conditionally includes
-Tin both launcher scripts. Also removes Go runtime version from--versionoutput.